"! An optimised array class to hold byte values (0..255) "
Array subclass: ByteArray [
<category: 'Library-Collections'>
"! Info:
Convert the ByteArray to a String - where each byte in the array is interpreted as an ascii character.

Examples:
"
asString [
| str sz |
sz := self size.
str := String new: sz.
1 to: sz do: [ :i | 
	str at: i put: ((self at: i) asChar)
].
^ str
]

"! Info:
Return the value at position index in the array 

Examples:
"
at: index [
<stringAt self index>
(self includesKey: index) ifFalse: [ 
	self badIndex
].
self primitiveFailed
]

"! Info:
Return the byte at posiition index in the array, execute aBlock on error (out of bounds).

Examples:
"
at: index ifAbsent: aBlock [
<stringAt self index>
aBlock value
]

"! Info:
Insert a byte into the array at index 

Examples:
"
at: index put: aValue [
<stringAtPut aValue self index>
(self includesKey: index) ifFalse: [
	self badIndex 
].
self primitiveFailed
]

"! Info:
Low level element access at index. In most cases, at: should be used instead 

Examples:
"
basicAt: index [
<stringAt self index>
^ nil
]

]

"! Class methods for ByteArray "
MetaArray subclass: MetaByteArray [
<category: 'Library-Collections'>
"! Info:
Create a new ByteArray with sz elements
Examples:

"
new: sz [
<bytearrayAlloc self sz>
]

]

